#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    ll n;
    cin >> n;
    vector<int> arr(n + 10);
    multiset<int> st;
    set<int> set1;
    int i = 0;
    int difference = 0;
    bool different = 0;
    for (i = 1; i <= n; i++)
    {
        cin >> arr[i];
        st.insert(arr[i]);
        set1.insert(arr[i]);
    }
    if (set1.size() == 1)
    {
        cout << n << '\n';
        return;
    }
    if (set1.size() == n)
    {
        cout << 1 << '\n';
        return;
    }
    int ans = 0;
    while (!st.empty())
    {
        multiset<int> st3;
        set<int> set2;
        multiset<int> st2 = st;
        int count = 0;
        for (i = 1; i <= n; i++)
        {
            if (st2.count(arr[i]) == 1)
            {
                ans++;
                break;
            }
            else
            {
                auto it = st2.find(arr[i]);
                if (it != st2.end())
                    st2.erase(it);
                set2.insert(arr[i]);
                st3.insert(arr[i]);
                count++;
            }
        }
        n = count;
        st = st3;
        if (set2.size() == 1)
        {
            ans += st3.size();
            break;
        }
    }
    cout << ans << '\n';
}
int main()
{
    ll t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}
